
package com.jfinal.club.index;

import com.jfinal.aop.Before;
import com.jfinal.club.common.controller.BaseController;
import com.jfinal.club.common.interceptor.AuthCacheClearInterceptor;
import com.jfinal.club.common.model.Download;
import com.jfinal.club.common.model.Feedback;
import com.jfinal.club.common.model.Project;
import com.jfinal.club.common.model.Share;
import com.jfinal.club.common.model.Word;
import com.jfinal.club.common.model.Wordantonyms;
import com.jfinal.club.common.model.Wordcolor;
import com.jfinal.club.common.model.Wordmeaning;
import com.jfinal.club.common.model.Wordright;
import com.jfinal.club.common.model.Wordsynonyms;
import com.jfinal.club.download.DownloadService;
import com.jfinal.club.my.wordmeaning.MyWordmeaningService;

import java.util.List;

/**
 * 首页控制器
 */
public class IndexController extends BaseController {

	IndexService srv = IndexService.me;
	IndexService srv1 = IndexService.me;

	public void index() {
		/*List<Project> projectList = srv.getProjectList();
		

		setAttr("projectList", projectList);*/
		render("index.html");
	}
	public void find() {
		//Word word = getBean(Word.class);
		List<Word> wordList = srv.findword(getPara("wordName"));
		List<Wordmeaning> wordmeaningList = srv.findwordmeaning(getPara("wordName"));
		List<Wordright> wordrightList = srv.findwordright(getPara("wordName"));
		List<Wordcolor> wordcolorList = srv.findwordcolor(getPara("wordName"));
		List<Wordsynonyms> wordsynonymsList = srv.findwordsynonyms(getPara("wordName"));
		List<Wordantonyms> wordantonymsList = srv.findwordantonyms(getPara("wordName"));

		setAttr("wordList", wordList);
		setAttr("wordmeaningList", wordmeaningList);
		setAttr("wordrightList", wordrightList);
		setAttr("wordcolorList", wordcolorList);
		setAttr("wordsynonymsList", wordsynonymsList);
		setAttr("wordantonymsList", wordantonymsList);

		setAttr("wordName", getPara("wordName"));
		render("find.html");
	}

	@Before(AuthCacheClearInterceptor.class)
	public void clear() {
		srv.clearCache();
		redirect("/");
	}
}
